package com.kolakcc.loljclient.view.ui.renderer;

import java.awt.BorderLayout;
import java.awt.Component;

import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.ListCellRenderer;

import com.kolakcc.loljclient.model.Champion;
import com.kolakcc.loljclient.model.CustomGamePlayer;

public class CustomGameParticipantListItemRenderer implements ListCellRenderer<CustomGamePlayer> {

	@Override
	public Component getListCellRendererComponent(
			JList<? extends CustomGamePlayer> list, CustomGamePlayer value,
			int index, boolean isSelected, boolean cellHasFocus) {
		JPanel ret = new JPanel(new BorderLayout());
		ret.setOpaque(false);
		ret.add(new JLabel(value.summonerName), BorderLayout.CENTER);
		if ((value.championSelection != null) && (value.championSelection.championID != 0))
			ret.add(new JLabel(Champion.getChampionFromID(value.championSelection.championID).getDisplayName()), BorderLayout.EAST);
		return ret;
	}

}
